import * as cnt from '../constant'
export interface ListItem {
  value: string
  label: string
}

export interface MenuItem {
  id: string
  name: string
  icon?: string
  formId?: string
  children?: MenuItem[]
}

export type IWorkspace = {
  id?: string
  name: string
  description: string
  members: IMember[]
}
export type IWorkform = {
  formId?: string
  formName: string
  formRemark: string
  formType: string,
  parentId: string
}
export type IMember = {
  userId: string
  username: string
  role: any
  _id?: string
}

export enum FormType {
  Dirs = '0', // 目录
  System = '1', // 系统
  Custom = '2', // 自定义
  Forms = '3' // 活动
}
export enum OptionType {
  All = '0', // 我的
  Personal = '1', // 我的
  Share = '2', // 共享
  Collect = '3', // 收藏
  Others = '4', // 我填写他人的
  Recycle = '5' // 回收站
}
export enum SpaceType {
  Personal = 'personal',
  Group = 'group',
  Teamwork = 'teamwork'
}
export enum UserRole {
  Admin = 'admin',
  Member = 'user'
}

export const optionMenus = [
  {
    icon: 'zu11345a2',
    name: '全部',
    id: OptionType.All
  },
  {
    icon: 'zu11345a1',
    name: '我的活动',
    role: cnt.ROLE_TEACHER_MANAGER,
    id: OptionType.Personal,
    children: []
  },
  {
    icon: 'zu11345',
    name: '与我共享',
    role: cnt.ROLE_TEACHER_MANAGER,
    id: OptionType.Share
  },
  {
    icon: 'zu11728',
    name: '我的收藏',
    id: OptionType.Collect
  },
  {
    icon: 'zu11726',
    name: '我参与的活动',
    id: OptionType.Others
  },
  {
    icon: 'zu11727',
    name: '回收站',
    role: cnt.ROLE_TEACHER_MANAGER,
    id: OptionType.Recycle
  }
]

export enum BusineType {
  All = '', // 推荐
  Information = '1', // 信息登记
  Enroll = '2', // 活动报名
  Research = '3', // 问卷调研
  Vote = '4', // 投票
  Clock = '5', // 打卡
  Message = '6' // 通知
}
export const templateMenus = [
  // {
  //   icon: '',
  //   name: '推荐',
  //   id: BusineType.All
  // },
  {
    icon: 'zu11345a2',
    name: '信息登记',
    id: BusineType.Information,
    children: []
  },
  {
    icon: 'zu11345a1',
    name: '活动报名',
    id: BusineType.Enroll
  },
  {
    icon: 'zu11345',
    name: '问卷调研',
    id: BusineType.Research
  },
  {
    icon: 'zu11728',
    name: '投票评分',
    id: BusineType.Vote
  },
  {
    icon: 'zu11726',
    name: '打卡',
    id: BusineType.Clock
  },
  {
    icon: 'zu11726',
    name: '通知',
    id: BusineType.Message
  }
]

// 定义角色标签映射对象
export const roleLabels: Record<UserRole, string> = {
  [UserRole.Admin]: '管理员',
  [UserRole.Member]: '成员'
}

export interface ICollaborator {
  _id?: string
  userId: string
  username: string
  permissions: Array<number>
}

export enum SurveyPermissions {
  SurveyManage = 'SURVEY_CONF_MANAGE',
  DataManage = 'SURVEY_RESPONSE_MANAGE',
  CollaboratorManage = 'SURVEY_COOPERATION_MANAGE'
}
// 定义共享者权限标签映射对象
export const surveyPermissionsLabels: Record<SurveyPermissions, string> = {
  [SurveyPermissions.SurveyManage]: '活动管理',
  [SurveyPermissions.DataManage]: '数据管理',
  [SurveyPermissions.CollaboratorManage]: '共享管理'
}


export interface IFormItemRequest {
  /**
   * 业务分类
   */
  busineType: string;
  dataFormAttributeList: IDataFormAttributeList[];
  /**
   * 填报结束时间，格式同上
   */
  endTime: string;
  /**
   * 自定义活动名称
   */
  formName: string;
  /**
   * 自定义活动说明
   */
  formRemark: string;
  /**
   * 自定义活动类型
   */
  formType: string;
  /**
   * 是否允许删除结果
   */
  isDel: string;
  /**
   * 是否鉴权
   */
  isLogin: string;
  /**
   * 是否允许提交多份
   */
  isMultiple: string;
  /**
   * 消息置顶
   */
  isTop: string;
  /**
   * 是否允许修改结果
   */
  isUpdate: string;
  /**
   * 父活动ID，一级节点为 -1；
   */
  parentId: string;
  /**
   * 角色
   */
  roleType: string;
  /**
   * 填报开始时间
   */
  startTime: string;
  /**
   * 状态
   */
  status: string;
  /**
   * 使用权限
   */
  useLimit: string;
  [property: string]: any;
}

export interface IDataFormAttributeList {
  attrContent: string;
  attrName: string;
  attrOrder: number;
  attrRemark: string;
  attrType: string;
  busineType?: string;
  extendType: string;
  isRequired: string;
  validate: string;
  [property: string]: any;
}